/**
 * 
 */
package research.sbookmarking.input;

//import org.connotea.*;
import research.sbookmarking.*;
import java.util.*;

/**
 * This class controller for getting input, where it the commands to
 * execute against Connotea.org or retrieving the data from Connotea.org
 * <p> 
 * @author <A HREF="mailto:aatleung@gmail.com">Albert Leung</a>
 * @version 1.0
 */
public class InputController {

	private static InputController anInstance = null;
	
	/**
	 * The only way to instantiate this class is through 
	 * {@link #getInstance() getInstance}
	 */
	private InputController() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * Ensures that there is only one InputController instance. If an
	 * instance already exists it return the address of that instance
	 * otherwise it will instantiate an instance and save it.
	 * <p>
	 * @return an instance of this object.
	 */
	
	public static InputController getInstance() {
		if (anInstance == null) {
			anInstance = new InputController();
		}
		
		return anInstance;
	}
	
	/**
	 * This method calls the appropriate method to extract the commands
	 * to be executed against Connotea from the given filename.
	 * <p> 
	 * @param filename contains the name of the file that contains the 
	 * 				   commands to be executed against Connotea.
	 * @return a list of commands to be executed against Connotea.
	 */
	public ArrayList getCommands(String filename) {
		return null;
	}
	
	/**
	 * The method executes the commands that was retrieved from the method 
	 * {@link #getCommands(String) getCommands} 
	 * <p>
	 * @param commands a list of commands to be executed.
	 * @return the data in the {@link DataContainer DataContainer} object.
	 */
	public DataContainer getData (ArrayList commands) {
		Iterator items = commands.iterator();
		
		while (items.hasNext()) {
			Command aComment = (Command)items.next();
			aComment.execute();
		}
		
		return packageData(commands);
	}
	
	/**
	 * It extracts the data collected and combines it into a DataContainer
	 * object.
	 * <p>
	 * @param aList ArrayListdata 
	 * @return the data in the {@link DataContainer DataContainer} object.
	 */
	private DataContainer packageData (ArrayList aList) {
		return null;
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println (((new Object()).getClass()).getName());
	}

}
